package com.mine.modules.vm.controller;


import com.mine.common.domain.vo.Result;
import com.mine.modules.vm.domain.dto.BindingSensor;
import com.mine.modules.vm.domain.dto.BindingSensorPointDto;
import com.mine.modules.vm.domain.query.PointPageQuery;
import com.mine.modules.vm.entity.VmPoint;
import com.mine.modules.vm.service.IVmPointService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-04-09
 */
@RestController
@RequestMapping("/vm/point")
@Api(tags = "标签点位管理")
public class VmPointController {

    @Resource
    private IVmPointService pointService;

    @ApiOperation(value = "分页获取点位列表", notes = "分页获取点位列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Result<?> queryPageList(PointPageQuery pointPageQuery) {
        return pointService.queryPageList(pointPageQuery);
    }

    @ApiOperation(value = "添加或编辑", notes = "添加或编辑")
    @RequestMapping(value = "/addOrEdit", method = {RequestMethod.POST})
    public Result<?> addOrEdit(VmPoint vmPoint) {
        return pointService.addOrEdit(vmPoint);
    }

    @ApiOperation(value = "删除", notes = "删除")
    @RequestMapping(value = "/delete", method = {RequestMethod.GET})
    public Result<?> delete(@RequestParam String id) {
        return pointService.delete(id);
    }
    @ApiOperation(value = "批量删除", notes = "批量删除")
    @RequestMapping(value = "/deleteBatch", method = {RequestMethod.GET})
    public Result<?> deleteBatch(@RequestParam String ids) {
        return pointService.deleteBatch(ids);
    }

    @ApiOperation(value = "通过id查询点位详情", notes = "通过id查询点位详情")
    @RequestMapping(value = "/getDetailsById", method = {RequestMethod.GET})
    public Result<?> getDetailsById(@RequestParam String id) {
        return pointService.getDetailsById(id);
    }

    @ApiOperation(value = "批量新增点位下传感器", notes = "批量新增点位下传感器")
    @RequestMapping(value = "/batchBindingSensorByPointId", method = {RequestMethod.POST})
    public Result<?> batchBindingSensorByPointId(BindingSensorPointDto bindingSensor) {
        return pointService.batchBindingSensorByPointId(bindingSensor);
    }

    @ApiOperation(value = "批量删除点位下传感器", notes = "批量删除点位下传感器")
    @RequestMapping(value = "/batchDeleteSensorByPointId", method = {RequestMethod.POST})
    public Result<?> batchDeleteSensorByPointId(BindingSensorPointDto bindingSensor) {
        return pointService.batchDeleteSensorByPointId(bindingSensor);
    }

    @ApiOperation(value = "设置视角", notes = "设置视角")
    @RequestMapping(value = "/setAngleView", method = {RequestMethod.GET})
    public Result<?> setAngleView(@RequestParam String id, @RequestParam(required = false) String angleView) {
        return pointService.setAngleView(id, angleView);
    }

}
